package com.testfileupload.uploadimg.design.iterator;

import java.util.ArrayList;
import java.util.PrimitiveIterator;

public class Project implements IProject{
    //定义一个项目列表，所有的项目都放在这里
    private ArrayList<IProject> projects = new ArrayList<>();

    //项目名称
    private String name="";
    //项目成员数量
    private int num=0;
    //项目费用
    private int cost=0;

    public Project() {
    }
    //定义构造函数。把老板需要看到的信息存储起来

    public Project(String name, int num, int cost) {
        //赋值到类的成员信息变量中
        this.name = name;
        this.num = num;
        this.cost = cost;
    }

    @Override
    public String getProjectInfo() {
        String info = "";
        info = info+"项目名称是"+this.name;
        info = info+"项目人数是"+this.num;
        info = info+"项目花费是"+this.cost;
        return info;
    }

    @Override
    public void add(String name, int num, int cost) {
        this.projects.add(new Project(name,num,cost));
    }

    @Override
    public IProjectIterator iterator() {
        return new ProjectIterator(this.projects);
    }
}
